home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
353_02
/
scopeop.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-18
|
622b
|
30 lines
// Chapter 1 - Program 2
#include <iostream.h>
int index = 13;
main()
{
float index = 3.1415;
cout << "The local index value is " << index << "\n";
cout << "The global index value is " << ::index << "\n";
::index = index + 7; // 3 + 7 should result in 10
cout << "The local index value is " << index << "\n";
cout << "The global index value is " << ::index << "\n";
}
// Result of execution
//
// The local index value is 3.1415
// The global index value is 13
// The local index value is 3.1415
// The global index value is 10